package com.example.schoolenterprisealliance.adapter;

import android.graphics.ImageFormat;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.schoolenterprisealliance.R;
import com.example.schoolenterprisealliance.bean.Information;
import com.example.schoolenterprisealliance.bean.Policy;
import com.example.schoolenterprisealliance.io.GetRoundBitmapByShader;
import com.example.schoolenterprisealliance.io.MyBitmap;
import com.example.schoolenterprisealliance.time.Time;

import java.io.IOException;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class InformationAdapter extends BaseQuickAdapter <Information, BaseViewHolder> {


    public InformationAdapter(int layoutResId, @Nullable List<Information> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, Information item) {
//        helper.addOnClickListener(R.id.iv_left);
//        helper.addOnClickListener(R.id.iv_right);
        try {
            helper.setText(R.id.tv_title,item.getTitle())
                    .setText(R.id.tv_time, Time.longToString(item.getTime()))
                    .setImageBitmap(R.id.iv_img, GetRoundBitmapByShader.getRoundBitmapByShader(MyBitmap.getBitmap(item.getImgUrl()),300,180,20,0));
        } catch (IOException e) {
            e.printStackTrace();
        }

    }


}